//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _OBJECTSTAB_H
#define _OBJECTSTAB_H
//
#include <QHash>
#include <QTabWidget>
#include <common/id.h>
#include "view.h"
//
class MainView;
class ObjectPage;
class ObjectsTab:public QTabWidget,public View
{
   Q_OBJECT
   Q_DISABLE_COPY(ObjectsTab)
//construction
public:
   ObjectsTab(MainView *p_main_view,QWidget *p_parent=0);
//slots
protected slots:
   void on_current_changed(int index);
   void on_tab_close_requested(int index);
//View
protected:
   void handle_set_attr_group();
   void handle_post_primitive(const Primitive &prim);
//use
public:
   void open_page(Identified *p_object);
   void close_page(Identified *p_object);
//implementation
private:
   typedef QHash<Id,ObjectPage*> PageHash;
   MainView *const main_view;
   PageHash pages;
   void remove_page(Id id);
};
//
#endif
